package com.jvm.escape.thiz;

/**
 * ThisEscapeExample01.. 构造器内 多线程调用方法引起,
 *
 *  无论是本类中的方法，jdk11环境下都可运行
 *
 * @author Lizhong
 * @date 2019/3/25
 */
public class ThisEscapeExample01 {
    int i;
    final int j;

    public ThisEscapeExample01() {
        i = 1;
        j = 1;
        new Thread(new MyRun()).start();
        new Thread(() -> {
            // method01();
        }).start();
    }
    class MyRun implements Runnable{

        @Override
        public void run() {
            System.out.println("hello"+ThisEscapeExample01.this.i+ThisEscapeExample01.this.j);
        }
    }

    public void method01() {
        System.out.println("hello"+ThisEscapeExample01.this.i+ThisEscapeExample01.this.j);
    }

    public static void main(String[] args) {
         new ThisEscapeExample01();
    }
}
